<?php
include "conn.php";
//获取前端传入的用户名，进行存在检测
if(isset($_POST['user'])){


    $user = $_POST['user'];
    $result = $conn->query("select * from registry where username='$user'");
    if($result->fetch_assoc()){//存在结果，登录成功
       
        if(isset($_POST['pass'])){
            $pass = sha1($_POST['pass']);
            $result = $conn->query("select * from registry where username='$user' and password='$pass'");
            if($result->fetch_assoc()){
                echo 'success';
            }else{
                echo 'fail';
            }
        }
    }else{
        echo 'false';
    }
}

